import type { Module } from "../types";
// import { hmr } from "../hooks";
import esConfig from "../../src/uni_modules/cool-cs/config";
import uiConfig from "../../src/uni_modules/cool-ui/config";
import appConfig from "../../src/uni_modules/cool-app/config";

// 模块列表
const list: any[] = [
	{
		name: "cool-cs",
		...esConfig(),
	},
	{
		name: "cool-ui",
		...uiConfig(),
	},
	{
		name: "cool-app",
		...appConfig(),
	},
];
// hmr.getData("modules", []);

// 模块对象
const module = {
	list,
	get(name: string): Module {
		console.log(this.list);
		return this.list.find((e) => e.name == name)!;
	},
	config(name: string) {
		return this.get(name).options || {};
	},
	add(data: Module) {
		this.list.push(data);
	},
};

export { module };
